package com.liuyi.usercenterservice.common;

/**
 * @author 刘燚
 * @version v1.0.0
 * @Description TODO
 * @createDate：2024/3/26 23:26
 * @email liuyia2022@163.com
 */
public class ResultUtils {
    public static <T> BaseResponse<T> success(T data) {
        return new BaseResponse<T>(200, "ok", data);
    }

    public static BaseResponse error(ErrorCode errorCode) {
        return new BaseResponse<>(errorCode.getCode(), errorCode.getMessage());
    }

    public static <T> BaseResponse<T> fail(int code, String message, T data) {
        return new BaseResponse<>(code,message,data);
    }
}
